<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <input type="text" v-model="tel" v-mobile>
  </div>
</body>
<script src="lib/vue.js"></script>
<script>
 
  new Vue({
    el: '#app',
    data: {
      tel: ''
    },
    directives: {
      mobile: {
        update (el) {
          console.log(el.value)
          if (/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/.test(el.value)) {
            el.style.color = 'green'
          } else {
            el.style.color = 'red'
          }
        }
      }
    }
  })
  
</script>
</html>